home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / tclib20.zip / MENUHK.H < prev    next >
C/C++ Source or Header  |  1988-12-03  |  11KB  |  162 lines

  1. /* TCHK 2.0 - Howard Kapustein's Turbo C library       12-3-88 */
  2. /* Copyright (C) 1988, Howard Kapustein.  All rights reserved. */
  3.  
  4. /* menuhk.h  -  header file for menu routines */
  5.  
  6. #ifndef MENUHK_HEADER
  7. #define MENUHK_HEADER   1
  8.  
  9. #include <howard.h>
  10. #include <video.h>
  11.  
  12. #ifndef MENUHK_DEFINES
  13.  
  14. typedef struct popup_field {        /* doubly circular linked list */
  15.                 char *command;          /* ptr to command text (string) */
  16.                 int y;                  /* y-coord of command on screen */
  17.                 char flag;              /* flags, i.e. Disabled, etc. */
  18.                 char key;               /* 1-touch key */
  19.                 char offset;            /* offset of key in string */
  20.                 int retval;             /* value returned when selected ( != 0 ) */
  21.                 struct popup_header *submenu;   /* submenu (used in hierarchial menus) */
  22.                 struct popup_field *next;       /* next item in list */
  23.                 struct popup_field *previous;   /* previous item in list */
  24.             };
  25.  
  26. typedef struct popup_header {
  27.                 char *videosave;                /* ptr to saved video buffer */
  28.                 struct text_info inforec;       /* saved video info */
  29.                 int left, top, right, bottom;   /* menu coordinates */
  30.                 int margc;                      /* menu arguments */
  31.                 struct popup_field *margv;      /* ptr to list of menu args (commands) */
  32.                 struct popup_field *current;    /* current item hilited */
  33.                 char *menusave;                 /* ptr to menu video buffer */
  34.                 int colnorm;                    /* Colors:     normal */
  35.                 int colcmdkey;                              /* 1-touch command key */
  36.                 int colhilite;                              /* hilited/selected item */
  37.                 int coldisabled;                            /* disabled command */
  38.                 int coldishilite;                           /* hilited disabled item */
  39.                 unsigned flags;                 /* Flags: QEFxxxxH = Quit, ESC equals Quit, Free memory on quit, Hierarchial */
  40.                                                 /*        xxIRCEDW = case Independent for 1-touch keys, Restore cursor before */
  41.                                                 /*                   return don't hide Cursor, Erase menu on cleanup/free, */
  42.                                                 /*                   Disabled off (are valid choices), Wraparound */
  43.                 char internal;                  /* Internal flags: xxxxxxx1 = 1st time */
  44.             };
  45.  
  46. typedef struct litebar_field {      /* doubly circular linked list (w/4-way directional) */
  47.                 char *command;          /* ptr to command text (string) */
  48.                 int x, y;               /* x/y-coord of command on screen (rel to litebar window) */
  49.                 char flag;              /* flags, i.e. Disabled, etc. */
  50.                 char key;               /* 1-touch key */
  51.                 char offset;            /* offset of key in string */
  52.                 char *message;          /* ptr to message text (string) */
  53.                 int retval;             /* value returned when selected ( != 0 ) */
  54.                 struct litebar_header *submenu;   /* submenu (used in hierarchial menus) */
  55.                 struct litebar_field *next;       /* next field */
  56.                 struct litebar_field *previous;   /* previous field */
  57.                 struct litebar_field *left;       /* left item in menu (left arrow) */
  58.                 struct litebar_field *right;      /* right item in menu (right arrow) */
  59.                 struct litebar_field *up;         /* up item in menu (up arrow) */
  60.                 struct litebar_field *down;       /* down item in menu (down arrow) */
  61.             };
  62.  
  63. typedef struct litebar_header {
  64.                 char *videosave;                /* ptr to saved video buffer */
  65.                 struct text_info inforec;       /* saved video info */
  66.                 int left, top, right, bottom;   /* litebar coordinates */
  67.                 int margc;                      /* menu arguments */
  68.                 struct litebar_field *margv;    /* ptr to list of menu args (commands) */
  69.                 struct litebar_field *current;  /* current item hilited */
  70.                 int msgx, msgy;                 /* x/y-coord for message */
  71.                 char *menusave;                 /* ptr to menu video buffer */
  72.                 struct keylist *quitkey;        /* Quitkey - leave litebar menu */
  73.                 int colnorm;                    /* Colors:     normal */
  74.                 int colcmdkey;                              /* 1-touch command key */
  75.                 int colhilite;                              /* hilited/selected item */
  76.                 int coldisabled;                            /* disabled command */
  77.                 int coldishilite;                           /* hilited disabled item */
  78.                 int colmessage;                             /* message */
  79.                 unsigned flags;                 /* Flags: QEFxxxxH = = Quit, ESC equals Quit, Free memory on quit, Hierarchial */
  80.                                                 /*        xxIRCEDW = case Independent for 1-touch keys, Restore cursor before return */
  81.                                                 /*                   don't hide Cursor, Erase menu on cleanup/free, Disabled off (are valid choices), Wraparound */
  82.                 char internal;                  /* Internal flags: xxxxxxx1 = 1st time */
  83.             };
  84.  
  85. typedef struct keylist {                    /* linked list of key values (1-512) */
  86.                 int keyval;                     /* key code (1-512) */
  87.                 struct keylist *next;           /* ptr to next key */
  88.             };
  89.  
  90.                                 /* Header flags */
  91. #define QUITMENU        0x8000                /* quit */
  92. #define ESCQUIT         0x4000                /* ESC equals Quit */
  93. #define FREEMENU        0x2000                /* free memory on quit */
  94. #define HIERARCHIAL     0x0100                /* hierarchial menus */
  95. #define CASEINDEP       0x0020                /* case independent 1-touch keys */
  96. #define RESTORECURSOR   0x0010                /* restore cursor before returning */
  97. #define CURSORON        0x0008                /* leave curson on (no hide) */
  98. #define ERASEMENU       0x0004                /* erase menu from screen on cleanup */
  99. #define DISABLEOFF      0x0002                /* disabled off (commands are used) */
  100. #define WRAPAROUND      0x0001                /* wraparound (over top -> bottom) */
  101.  
  102.                                 /* Internal flags (don't muck with these) */
  103. #define FIRSTTIME       0x01                /* first time menutype_get() is called */
  104.  
  105.                                 /* Command (Field) flags */
  106. #define ENABLED         0x00                /* enabled */
  107. #define DISABLED        0x01                /* disabled */
  108. #define NOTOPTION       0x02                /* not an option (static text) */
  109. #define STATICTEXT      NOTOPTION           /* not an option (static text) */
  110. #define MAXMENUCHOICES  23
  111. #define MENUHK_DEFINES  1
  112. #endif
  113.  
  114. /* function prototypes */
  115. char menu_lotus(int argc, char cmdkey[], char *command[], int col[],
  116.             char *message[], int msglen[], int normal, int highlite,
  117.             int cmdrow, boolean clockon, int clockrow, int clockcol, int clockcolor);
  118.                         /* lotus slash-bar menu */
  119. void lotus_setup(int argc, byte *command[], char cmdkey[], int col[],
  120.                  byte *message[], int msglen[]);
  121.                         /* generates info needed for menu_lotus */
  122.  
  123. struct lotus_header *lotus_alloc(int argc, int cmdrow, char *command[], int cmdkey[],
  124.                                  char cmdflag[], char *message[], struct lotus_clock *clk,
  125.                                  int colnorm, int colcmdkey, int colhilite, int coldisable,
  126.                                  int coldishilite, int colmessage, int d